/**
 * @author zmx
 * @description hex色值转rgba色值
 * @param hex hex值（如：#ffffff）
 * @param opacity 需要生成的透明度（如：0.1）
 * @return RGBA 生成的值（如：rgba(255,255,255,0.1)）
 */

export function hexToRgba(hex:string, opacity:number) {
    const RGBA = "rgba(" + parseInt("0x" + hex.slice(1, 3)) + "," + parseInt("0x" + hex.slice(3, 5)) + "," + parseInt("0x" + hex.slice(5, 7)) + "," + opacity + ")";
    return RGBA
    // return {
    //     red: parseInt("0x" + hex.slice(1, 3)),
    //     green: parseInt("0x" + hex.slice(3, 5)),
    //     blue: parseInt("0x" + hex.slice(5, 7)),
    //     rgba: RGBA
    // }
}